home *** CD-ROM | disk | FTP | other *** search
- MAKE is originally one of UNIX utilities. MAKE is used to simplify
- the compilation and linkage process of high-level language (C, PASCAL,
- Fortran ..etc) programs consisting more than one source files. This MAKE is
- directly imported from the article by Allen Holub in Dr. Dobb's Journal, August
- 1985 issue and compiled under Microsoft C ver.4.0 and Lattice C ver.3.
-
- MAKE uses a makefile called MKFILE that describes the target files,
- their relationship(dependency) and actions(command line) as an example shown
- below.
-
- #
- # Make green using Microsoft C compiler
- #
-
- green.exe: yellow.obj blue.obj
- link yellow + blue /CO;
-
- yellow.obj: yellow.c color.h
- msc yellow /I c:\bin /Zi;
-
- blue.obj: blue.c color.h
- msc blue /I c:\bin /Zi;
-
- color.h:
-
- blue.c:
-
- yellow.c:
-
- # End of Make
-
- MAKE reads MKFILE and compares the last modification date of the target
- file or files with the modification dates of files on which these target files
- depend. If the target file is older than the dependant files, MAKE then does
- recompiling or relinking.
- In the example above, if you change something in yellow.c, MAKE
- discovers the change, recompiles yellow.c and generates yellow.obj. Moreover,
- because green.exe depends on yellow.obj, relinking is performed. If color.h is
- changed, both yellow.c and blue.c are recompiled and relinked.
- Because MAKE exactly defines the relationship between modules as
- described above, you can save the time of reconfiguring and recompiling
- everything.
-
- To use MAKE, you first need to create MKFILE with your text editor. The rule
- applied to MKFILE is :
-
- (1) A # sign in column 1 designates a comment line. The # must be in the
- leftmost column.
-
- (2) The dependency line comes first. It uses the format;
-
- "targetfile:dependentfiles"
-
- Ex.
- green.exe: yellow.obj blue.obj
-
- The colon is required (an error message is printed if it's not there)
- and no space is allowed between the filename and the colon.
- The dependencies are delimited from one another with white space (any
- combination of tabs or blanks). The dependencies must all be listed on
- a single line: however, any line terminated with a back-slash(\) will
- be continued to the next line.
-
- Ex.
- green.exe: yellow.obj\
- blue.obj
-
- No white space is allowed between the end of the line and the
- back-slash.
-
- (3) All files listed as dependencies must be used as targets somewhere in
- MKFILE. A null tareget(no dependencies) is permitted.
-
- (4) All lines following the dependency line, up to a blank line, are the
- actions executed to make the target. The blank line is required to
- terminate the block of actions. Any number of blank lines are permitted
- as a terminator, but any nonblank line following a blank line is assumed
- to be a new dependency line.
-
- (5) Targets having no dependenies will always be made.
- Ex.
- listing:
- print color.h yellow.c blue.c
-
- will always execute the print command.
-
- (6) For the sake of comparison, all nonexistent files are considered to
- exist and to be very old, so a nonexistent file listed to the left of
- a colon will always be made. The dates and times associated with a
- target are updated as soon as the target is made.
-
- After you have your customized MKFILE, you can run MAKE. In the command line,
- you just type MAKE.
- If you have a target filename after MAKE, MAKE starts doing make from
- there in MKFILE. For example, if you type MAKE yellow.obj, yellow.obj may be
- updated, however green.exe will never be updated.
-
-
- /* Warning */
-
- MAKE compiler under Lattice C will require MS-DOS ver 3.0 or above.